<?php
session_start();
$rootURL = '/~n02585943/web_programming/final';
function IsLoggedIn()
{
	return UserId() != FALSE;
}

function UserId()
{
	return isset($_SESSION['UserId']) ? $_SESSION['UserId'] : FALSE;
}

function User()
{
	
}

function RequireLogin()
{
	global $rootURL;
	if(!IsLoggedIn())
	{
		header("Location: $rootURL/views/Home/fb_javascript.php");
		die();
	}
}
/*
function DoLogin($email, $password, $returnURL)
{
	global $rootURL;
	if(!empty($returnURL))
	{
		$_SESSION['returnURL'] = $returnURL;
	}
	elseif (isset($_REQUEST['returnURL']))
	{
		$_SESSION['returnURL'] = $_REQUEST['HTTP_REFERER'];
	}
	elseif(!isset($_SESSION['returnURL']) && isset($_SERVER['HTTP_REFERER']))
	{
		$_SESSION['returnURL'] = $_SERVER['HTTP_REFERER'];
	}
	
	if (isset($_SESSION['returnURL']))
		$returnURL = $_SESSION['returnURL'];
	else 
		$returnURL = $rootURL . '/views/Users/';
	
	$_SESSION['UserId'] = $email;
	header("Location: $returnURL");
	die();
}
*/
?>
    